<template>
  <div :style="'width: 100%; max-width: ' + props.width + 'px;height: ' + props.height + 'px'">
    <span class="image-edit-box">
      <el-upload
        class="ac-image" action=""
        :show-file-list="false"
        :accept="'image/*'"
      >
        <cc-icon size="30" color="#999" iconId="018dca3b4707c4c43a2f"></cc-icon>
      </el-upload>
    </span>
  </div>
</template>

<script setup>
const props = defineProps({
  modelValue: [Number, String],
  width: {
    type: Number,
    default: 100
  },
  height: {
    type: Number,
    default: 100
  },
  showText: Boolean
});
</script>

<style scoped>
.ac-image {
  height: 100%;
  width: 100%;
  flex: 1;
  justify-content: center;
  align-items: center;
  display: flex;
  border: 1px dashed #c2c2c2;
}
.ac-image :deep(.el-upload) {
  display: flex;
  text-align: center;
  cursor: pointer;
  outline: 0;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}
.ac-image :deep(.el-upload span) {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.ac-image:not(.is-disabled) :deep(.el-upload) {
  cursor: pointer;
}
.ac-image:not(.is-disabled) :deep(.el-upload:hover) {
  border-color: #409EFF;
}
.loading-icon {
  font-size: 28px;
  color: #8c939d;
  position: absolute;
}
.plus-icon {
  font-size: 28px;
  color: #8c939d;
  position: absolute;
}
.ac-image img {
  max-width: 100%;
  max-height: 100%;
}
.image-box {
  border: 1px dashed #d9d9d9;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.image-box img {
  max-width: 100%;
  max-height: 100%;
}
.ac-image :deep(.el-upload:after) {
  display: block;
  margin-top: 100%;
  content: ""
}
.image-item {
  position: relative;
}
.image-item .ac-icon {
  position: absolute;
  top: 5px;
  right: 5px;
}
</style>